using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Daniel.Core.Models.Mapping
{
    public class UrlRecordMap : EntityTypeConfiguration<UrlRecord>
    {
        public UrlRecordMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.EntityName)
                .IsRequired()
                .HasMaxLength(400);

            this.Property(t => t.Slug)
                .IsRequired()
                .HasMaxLength(400);

            // Table & Column Mappings
            this.ToTable("UrlRecord");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.EntityId).HasColumnName("EntityId");
            this.Property(t => t.EntityName).HasColumnName("EntityName");
            this.Property(t => t.Slug).HasColumnName("Slug");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.LanguageId).HasColumnName("LanguageId");
        }
    }
}
